/*
 * weight_sensor_amp.h
 *
 * Created: 28/02/2012 11:09:48
 *  Author: Dani
 */ 
#define AMP_PORT PORTA
#define AMP_PIN PINA
#define AMP_DDR DDRA

// Noise filtering: 200 samples.
// Tested at 2, 10, 64, 100, 200, 255 and 500 samples.
#define NUM_SAMPLES1 4000
// Mean value. If The result of the sample is between 2 integer numbers, 
// (e.g.: 4 and 5) and therefore the result changes constantly, it will
// tend to keep the lower number (4).
#define NUM_SAMPLES2 40

int16_t WeightRead();
void WeightSensorInit();
uint16_t WeightNoCalibrated();
void ShowWeight();
void WeightDataUpdate();

void sensorInit();
// 0 => 4,00; 127 => 6,40;
void setFirstStageGain(uint8_t gain);
// 0 => 17,5; 7 => 200;
void setSecondStageGain(uint8_t gain);
// 0 => 0 volt; 255 => 5 volt;
void setOutputOffset(uint8_t offset); 